package me.muci.B_threadMethods.synchronizedTest;

/**
 * ClassName: MyThread <br/>
 * Description: <br/>
 * date: 2021/8/9 14:13<br/>
 *
 * @author muci<br />
 * @description
 * @since JDK 1.8
 */
public class MyThreadWithSync implements Runnable{

    static MyThreadWithSync instance = new MyThreadWithSync();

    @Override
    public void run() {
        synchronized (this){
            System.out.println("我是线程："+Thread.currentThread().getName());

            try {
                Thread.sleep(4000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName() + "结束");
        }
    }
}
